<?php

/**
 * Created by XM·Tan.
 * Motto: Who shuts love out, in turn shall be shut out from love.
 * Date: 2020/12/23 17:12
 */
namespace app\common\lib;

class Num {

    /**
     * 设置随机 4 位 或者 6 位数字
     * @param int $len
     * @return int
     */
    public static function getCode(int $len = 4) {
        $code = rand(1000, 9999);
        if ($len == 6) {
            $code = rand(100000, 999999);
        }
        return $code;
    }

}